Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

Retro是什麼?來設計一場Retro吧

Retro是什麼?來設計一場Retro吧

第二章:6 一行程式碼研發策略

第二章:6 一行程式碼研發策略

JavaScript 程式執行原理:hw4:What is this?

JavaScript 程式執行原理:hw4:What is this?


Comments